package model;

import java.io.Serializable;
import java.util.*;

public class Course implements Serializable{

	private static final long serialVersionUID = 1L;
	String name;
	String description;
	int numOfpts;
	int numOfRegistered;
	int capacity;
	int groupNum;
	String creator;
	ArrayList<Session> sessions;
	ArrayList<String> users;
	
	public Course(String name,String description,int numOfpts,int capacity,int numOfRegistered, int groupNum,
			ArrayList<Session> sessions,String creator,ArrayList<String> users){
		this.name = name;
		this.description = description;
		this.numOfpts = numOfpts;
		this.numOfRegistered = numOfRegistered;
		this.capacity = capacity;
		this.groupNum = groupNum;
		this.sessions = new ArrayList<Session>(sessions);
		this.creator = creator;
		this.users =  new ArrayList<String>(users);
	}
	public String getCourseName() {
		return name;
	}
	public String getDescription() {
		return description;
	}
	public int numOfpts() {
		return numOfpts;
	}
	public int getNumOfRegistered() {
		return numOfRegistered;
	}
	public int getCapacity() {
		return capacity;
	}
	public int getGroupNum() {
		return groupNum;
	}
	public ArrayList<Session> getSessions() {
		return sessions;
	}
	public boolean checkOverlap(Course newCourse){
		if(this.equals(newCourse)) return false;
		for(Session session:this.sessions){
			if(session.checkOverlapList(newCourse.sessions)) return true;
		}
		return false;
	}
	public String getCreator() {
		return creator;
	}
	public ArrayList<String> getUsers(){
		return users;
	}
	
}
